﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000122602371";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCWOlBdn2H3v2wOybu7mSFcfRoxlMNHJWEKHmxY2M+M3A4a3Qohmw86wgH219SaIneoCQ3xqh3PmR868Ff54V6OrOYDTHZaBJax3Bns1KvP5KA5AXXDN9OnYtEuHVZYrVKBpQvPzHiuSIqrM9125zelupg6iVAgygd9ABo46L4hXYuqDSX7qVHF3kOtBB89Gf53WiyPhV7TE+1xmh7UvUxosibaspeCioftvQWrfKv0BARtOQKrwDQ+FXmMdHia55Loq8yAKlwuzGhsFp6U5AIYUgYRLRE9W3k6eEo3gxsW4mmHsO9oOMhpDR/DOgOa556VzucPo6U1R7EVblak3/u3AgMBAAECggEAf4S0XyRBdplIUi0vbAiJ5wZSS6/pKuUxv/MfKTOwyfKpDmh+hxQmE0xHeo6uar/DLiGxcmdisqtZdSA6rWN+bkGZZUdsVvD6MbORVhUYWnnI/1qb6b/jq3wX77r7Zn6JQH8mzZbVAauV+ckmvh16gPUo7tdL6ulS/eouWAxIB+0bOvFXM+erkwfSIXXar0Diu5R4fBvSl5gOlJKGEvCA6Lju1Bok6KE1qsAeDiwwjkovF0eH+Uryey9kjshrpp/oCkbNnSg7wciLIQOPhO54ttaL/JWRCrbwP0DOdgy9h/N7+YYaUbNABlYKchrjzxI/LeZA99FIbEhQBhyuwMEZ8QKBgQDsS+jfIODYV1wouWjqFS9RPUhP18EPrubfugBn5t+JfNMCvL5CBVIvcrAdQsl0hrKASLJ+iFoSxyt9y62ky5J2IrmImOmFz1ICzZSsMUe9WHibIm0O9zl72csneZtXriLUYBMRRhOEwrOBygeSb/tX7CFfzCwuI335tC4MV1u19QKBgQCiwSSWyryyL/2RL2lqRj6pAmjfk9fv9a0TZvPtCj0Oj4gv2M/fofOOWZPil0dYn1iddIoNxnvTJl+PupGjLEORMIe3A4cTWOCxBt+/hwH9NmVbDRQDMWpYNS8jieFzl3+STAapUH9JXf/u1g98p24OR8ypDx/O66UCvNCuvrjzewKBgGskcE7cBZeS5QLCL0QUnwPjGaq6VZva3myLVivGj40zwCn5kvs0lnNVOW3LHrVrbfyk+epNwSnKjXnYpL+YXqyaSi4Zx6kYvELxHHyHS9QbDXSqQ3EJwFLcCjW3+ivjlX9eoMawU6Fa9zHefVh01i6jru5VEaNKDJDwlgCai8cRAoGAc78IVnU4XUDkBCzDu2DZjzi3fMmX+H+v5uyA7UMqyQAqylxW+aQjokjyc2NCyjQIwXHv/Hv7896Gd6EnkfQY2Vi6K93GYmwC3+MTnRJWx823p1lVsi+igbjRHWUhgSNtBo4q7p7g5zyCl0iFGxG3o1BMrK6k4HOVlqzRfHUG86ECgYArSimMvZh6OCwc7kLLrby9JwW+HXhtQvTx1AA31BP4i1t8b9MhqbaWl1T6Kh0ylOOIzckUBgUZWs5m3BNc1t00Q1gKufWtUoJrSs6sKpQq2RRaC7tPEEpXiI87CBZBkkL8Ie7cY8fgvSKEZkOXNtfh1P00rLo/oqh6ZJvaP57r6g==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArNjVR3dtSfbr7GUVXxl2K88mqZ0CQlepW4swWY8NTjbrX3FT3llUneWh1AVtE/i4Y6z8hx2MfwvAGbbh244nvuEFynatw7TOdPipsN2acQmgvSlSl+123qr7V1Tr2tFlvssgje745t89P1HmKRU6/ccEH9ubReySeHhjWjqGuNiJ6nrhgOynS6TZIQjpu1qcjDYGPiISj/r6mk9BtlWjRD6UiywrVgLTVvXV3wVwZCRJC2TRuI/34uspG6unhiUWciZJ+WmxwaCVkhyFKXiOvUlSH5ip2lWGn1JFUEU7XCtCXcRa9lJJ6/3gQkB+hfgaykGOrZJnRRshtE0avrRxjQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://xhdfruitstore.free.idcfengye.com/xhd2.3/OrderAddSuccess.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://xhdfruitstore.free.idcfengye.com/xhd2.3/OrderAddSuccess.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

